package com.tianhua.javs.core.engine.filter;

import com.tianhua.javs.client.bean.JavsTranslateContextBean;
import com.tianhua.javs.core.engine.PipelineTranslator;
import com.tianhua.javs.core.engine.TranslateFilter;
import com.tianhua.javs.core.factory.PredicateFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Description:赋值语句过滤处理
 * date: 2022/2/11
 *
 * @author shenshuai
 * @version 1.0.0
 * @since JDK 1.8
 */
@Component(value = "assignFilter")
public class AssignFilter implements TranslateFilter {
    @Autowired
    private PredicateFactory predicateFactory;

    @Resource(name = "javsPipelineTranslator")
    private PipelineTranslator javsPipelineTranslator;

    @Override
    public String filter(JavsTranslateContextBean translateContextBean, String javsShell) {
        if(javsShell.contains("=")){
            //do = bo.convertdo()
            String [] assignArr = javsShell.split("=");

            //处理赋值语句右边的内容
            boolean javsKeyward = predicateFactory.isJavsKeyWard(assignArr[1]);
            if(javsKeyward){
                //javsPipelineTranslator.translateKeyWard(translateContextBean,javsShell,assignArr[1]);
            }else {

            }

        }else {

        }
        return null;
    }
}
